<% @page_title = "多背一公斤 | 个人设置" -%>

<% content_for(:sidebar) do -%>
  <h3 class="nt">其它设置 <%= title_suffix %></h3>
  <p><a href="/setting/changepassword">修改密码</a></p>
<% end -%>

<h3 class="nt"><%= h @user.login %>的设置</h3>
<% form_for :user, :url => user_path(@user), :html => {:method => 'put'} do |f| -%>
<h4>基本资料</h4>
<div style="margin-left:20px;">
  <table border="0" cellspacing="5" cellpadding="0">
    <tr>
      <td><label for="user_avatar">头 像</label></td>
      <td><%= avatar_for @user, 'large' %> <%= link_to "换头像", "/setting/avatar" %></td>
    </tr>
    <tr>
      <td><label for="user_login">昵 称</label></td>
      <td><%= f.text_field :login, :size => 10 %></td>
    </tr>
    <tr>
      <td><label for="user_blog">Blog</label></td>
      <td><%= f.text_field :blog_url, :size => 30 %></td>
    </tr>
    <tr>
      <td><label for="user_bio">简 介</label></td>
      <td><%= f.text_area :bio, :rows => 5, :cols => 40 %></td>
    </tr>
  </table>
</div>
<h4>志愿者个人信息</h4>
<p><span style="color:red">使用本人真实头像</span>，填写完成信息称为志愿者，之后可以申请学校服务小组（今后会有更多的权限）<br /></p>
<div style="margin-left:20px">
  <table border="0" cellspacing="5" cellpadding="0">
    <tr>
      <td><label for="user_full_name">姓 名</label></td>
      <td><%= f.text_field :last_name, :size => 4 %> <%= f.text_field :first_name, :size => 4 %></td>
    </tr>
    <tr>
      <td><label for="user_gender">性 别</label></td>
      <td><%= f.select :gender, {"女" => 1, "男" => 0} %></td>
    </tr>
    <tr>
      <td><label for="user_birth">生 日</label></td>
      <td><%= f.date_select :birth, :use_month_names => Status::MONTHS, :start_year => 1930, :end_year => Time.now.year %></td>
    </tr>
    <tr>
      <td><label for="user_location">居住地</label></td>
      <td><span id="area-title"><%= @user.location %></span> <%= link_to_remote "更改", :url => {:controller => 'areas', :action => 'list_for_user'}, :before => "$('#areas-list,#areas-list-notice').hide();$('#areas-list-spinner').show()" %></td>
    </tr>
    <tr>
      <td colspan="2">
        <div id="areas-list-spinner" style="display:none;color:gray;">正在获得城市列表 ...</div>
        <div id="areas-list-notice" style ="display:none;color:gray;"></div>
        <div id="areas-list" style="display:none;"></div>
        <%= f.hidden_field :area_id %>
      </td>
    </tr>
    <tr>
      <td><label for="user_phone">手 机</label></td>
      <td><%= f.text_field :phone, :size => 12 %></td>
    </tr>
    <tr>
      <td><label for="user_privacy">以上信息</label></td>
      <td><%= f.select :privacy, {"对所有人保密" => 0, "仅对友邻公开" => 1} %></td>
    </tr>
  </table>
</div>
<p><%= submit_tag "写好了，保存" %> 或 <a href="/">返回首页</a></p>
<% end -%>